Implement Promise.withResolvers() and Promise.try(func, arg1, arg2, /* …, */ argN)#2015
Implement Promise.withResolvers() and Promise.try(func, arg1, arg2, /* …, */ argN)#2015retyui wants to merge 1 commit into
Promise.withResolvers() and Promise.try(func, arg1, arg2, /* …, */ argN)#2015Conversation
…, /* …, */ argN)`
|
We are already working on Promise, probably will land them soon. Also hermes already supports |
|
One more note: Hermes has forked the polyfill, so any changes must be applied directly. |
@lavenzg as I see there is no such methods in the latest RN ver.
console.log(('---xdbg ' + ' '.repeat(60)).substr(0, 50), {
'Promise.try': Promise.try,
'Promise.withResolvers': Promise.withResolvers,
});
{"Promise.try": undefined, "Promise.withResolvers": undefined} |
@tmikov if it was forked, why the Hermes still uses an original package hermes/utils/promise/package.json Line 5 in adf76f4 |
withResolvers
hermes/lib/InternalJavaScript/01-Promise.js Line 411 in adf76f4 Polyfill
It is not. hermes/utils/gen-promise-internal-bc.sh Lines 25 to 27 in adf76f4 |
It's not in the current Hermes V1 (the version used by RN) yet. But it's in |


Summary
To be honest, contributing to open-source can be quite demotivating. I want to bring something useful to the community, but nobody seems interested in reviewing my pull requests: PR1 and PR2. The maintainers are unreachable, providing zero feedback on GitHub and ignore me in other social networks.
I’m fed up with trying to reach out to the promise maintainers for months, so I’ve decided to implement it directly in the Hermes engine.
Promise.try(fn, ...args):The
Promise.try()static method takes a callback of any kind (returns or throws, synchronously or asynchronously) and wraps its result in a Promise.Promise.withResolvers():Promise.withResolvers()is exactly equivalent to the following code:Test Plan
you run examples from MDN